<?php
ini_set( 'include_path', '../;.' );

//
// In order to view the output you will need to download neato from http://www.graphviz.org/
//

require_once( 'include_package.php' );

include_package( 'Datasources' );
include_package( 'Datasources.Filters' );
include_package( 'DatabaseModel' );
include_package( 'Renderers' );
include_package( 'Renderers.HtmlRenderer' );
include_package( 'Renderers.DotRenderer' );
include_package( 'Renderers.DotRenderer.ImageGenerators' );

Session::Start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>P-dd: A simple example outputting the default DOT generated diagram using a filtered TestDatasource</title>
</head>
<body>
<p>Note that filtered tables that reference, or are referenced by tables that are NOT filtered will be shown, but will be missing any details.</p>
<?php

$oDatasource = new TestDatasource();
$oFactory = new DatabaseFactory( new Filtration( $oDatasource, new Filter_TableReferencesTable( $oDatasource, 'SOCIETY_ACTIVITY' ) ) );
$oDatabase = $oFactory->ConstructDatabase();

$oImageGenerator = new DotImageGenerator( DotDatabaseRenderer::Render( new DotRendererConfiguration(), $oDatabase ) );
$sImage = $oImageGenerator->GenerateImageInSession( 'Gif', 'ExampleImage' );
echo( HtmlTag::Image( '../SessionImageLoader.php?ImageId='.$sImage, 'Dot generated diagram (using NEATO)') );

?>
</body>
</html>